
#include <iostream>
using namespace std;

class Solution 
{
public:
	void BubleSort(int* arr, int size)
	{
		for (int i = 0; i < size - 1; i++)
		{
			bool flag = 0;
			for (int j = 0; j < size - i - 1; j++)
			{
				if (arr[j] > arr[j + 1])
				{
					int tmp = arr[j];
					arr[j] = arr[j + 1];
					arr[j + 1] = tmp;
					flag = 1;
				}
			}
			if (flag == 0)
				break;
		}
	}
};

int main() 
{
	int arr[] = { 3, 34,5, 124, 135, 343, 31, 23, 65, 2325, 23, 45 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	Solution buble;
	buble.BubleSort(arr, sz);
	for (int i = 0; i < sz; ++i)
		cout << arr[i] << ' ' << endl;

	return 0;
}